package com.woniuxy.ams.service.impl;

import com.woniuxy.ams.dao.ProjectDao;
import com.woniuxy.ams.entity.Project;
import com.woniuxy.ams.service.ProjectService;
import com.woniuxy.ams.utils.String2Int;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectServiceImpl implements ProjectService {
    ProjectDao projectDao;
    @Autowired(required = false)
    public void setProjectDao(ProjectDao projectDao) {
        this.projectDao = projectDao;
    }

    @Override
    public int insert(Project project) {

        return projectDao.insert(project);
    }

    @Override
    public int delete(int id) {
        return projectDao.delete(id);
    }

    @Override
    public List<Project> findAll() {
        return projectDao.findAll();
    }

    @Override
    public int update(Project project) {
        return projectDao.update(project);
    }

    @Override
    public List<Project> findProjectById(String idStr) {
        int[] idArr = String2Int.getIntArr(idStr);
        return projectDao.findByIdStr(idArr);
    }
}
